home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlb20 / lib / getpass.c < prev    next >
C/C++ Source or Header  |  1990-10-08  |  330b  |  21 lines

  1. #include <ioctl.h>
  2. #include <stdio.h>
  3.  
  4. char *
  5. getpass(str)
  6.     char *str;
  7. {
  8.     static char buf[80];
  9.     struct sgttyb oldsb, newsb;
  10.  
  11.     gtty(0, &oldsb);
  12.     newsb = oldsb;
  13.     newsb.sg_flags &= ~ECHO;
  14.     stty(0, &newsb);
  15.     fputs(str, stderr); fflush(stderr);
  16.     buf[0] = 0;
  17.     fgets(buf, 80, stdin);
  18.     stty(0, &oldsb);
  19.     return buf;
  20. }
  21.